package XML;

import java.util.ArrayList;

public class TagXML {
	public TagXML father = null;
	public ArrayList<TagXML> taguri = new ArrayList<TagXML>();
	public ArrayList<Attribute> atribute = new ArrayList<Attribute>();
	public String name = null;
	public String value = null;
	public AddAttribute atribAdder = new AddAttribute();
	public DeleteAttribute atribDeleter = new DeleteAttribute();
	public AddTag tagAdder = new AddTag();
	public DeleteTag tagDelete = new DeleteTag();
	
	public void setName(String s){
		this.name = s;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public ArrayList<TagXML> getTaguri() {
		return taguri;
	}

	public ArrayList<Attribute> getAttribute() {
		return atribute;
	}
	
	public TagXML(){
		super();
	}
	
	public TagXML(TagXML f){
		super();
		this.father = f;
	}
	
	public TagXML(String n){
		super();
		this.name = n;
	}
	
	public TagXML(TagXML f, String n){
		super();
		this.father = f;
		this.name = n;
	}
	
	public TagXML(String n, String v){
		super();
		this.name = n;
		this.value = v;
	}
	
	public TagXML(TagXML f, String n, String v){
		super();
		this.father = f;
		this.name = n;
		this.value = v;
	}
	
	public void addAtrib(Attribute a){
		AddAttribute cmd = new AddAttribute(this, a);
		cmd.execute();
	}
	
	public void deleteAtrib(Attribute a){
		DeleteAttribute cmd = new DeleteAttribute(this, a);
		cmd.execute();
	}
	
	public void addSonAtrib(Attribute a, TagXML t){
		AddAttribute cmd = new AddAttribute(t, a);
		cmd.execute();
	}
	
	public void deleteSonAtrib(Attribute a, TagXML t){
		DeleteAttribute cmd = new DeleteAttribute(t, a);
		cmd.execute();
	}
	
	public void addTag(TagXML t){
		AddTag cmd = new AddTag(this, t);
		cmd.execute();
	}
	
	public void deleteTag(TagXML t){
		DeleteTag cmd = new DeleteTag(this, t);
		cmd.execute();
	}
}
